package com.b;

import java.text.DecimalFormat;
import java.util.Arrays;

/**
 * @author LW
 * @2020/10/9 10:22
 */
public class task1 {

    public static void main(String[] args) {
        double x=0;
        double[] num = {9.8,12,45,67,23,1.98,2.55,45};
        Arrays.sort(num);
        System.out.println("最大值:"+num[num.length-1]);
        System.out.println("最小值:"+num[0]);
        for (int i = 0; i < num.length; i++) {
            x += num[i];
        }
        DecimalFormat df = new DecimalFormat("#.00");//保留两位小数
        System.out.println("平均数:"+df.format(x/num.length));

    }
}
